home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / stdio / vsprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-21  |  627 b   |  45 lines

  1. #include <stdarg.h>
  2. #include <stdio.h>
  3.  
  4. #include <proto/exec.h>
  5.  
  6. /************************************************************************/
  7.  
  8. #ifdef __GNUC__
  9.  
  10. void PutChProc(void);
  11.  
  12. asm("
  13.     .globl _PutChProc
  14.  
  15. _PutChProc:
  16.     movl a3@,a0
  17.     movb d0,a0@+
  18.     movl a0,a3@
  19.     rts");
  20.  
  21. #else  /* !__GNUC__ */
  22.  
  23. static void __asm
  24. #ifdef SMALL_DATA
  25. __saveds
  26. #endif
  27. PutChProc(register __d0 char c, register __a3 char **Dest)
  28.  
  29. {
  30.   **Dest=c;
  31.   (*Dest)++;
  32. }
  33.  
  34. #endif  /* __GNUC__ */
  35.  
  36. int vsprintf(char *String, const char *FormatString, va_list Args)
  37.  
  38. {
  39.   char *t;
  40.  
  41.   t=String;
  42.   RawDoFmt((char *)FormatString,Args,PutChProc,&t);
  43.   return t-String-1;
  44. }
  45.